﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kokomo.Mirror.CliMetadata.Signatures
{
	public class CustomModifier : SignatureElement
	{
		public CustomModifier(
			bool isOptional,
			int typeToken
			)
		{
			this.isOptional = isOptional;
			this.typeToken = typeToken;
		}

		public readonly bool isOptional;
		public readonly int typeToken;

		public override string ToString()
		{
			return string.Format("[{0}]", CodedIndex.FromToken(this.typeToken));
		}

		public override bool Equals(object obj)
		{
			CustomModifier other = obj as CustomModifier;
			if (other == null) return false;

			bool equals =
				(this.isOptional == other.isOptional)
				&& (this.typeToken == other.typeToken)
				;
			return equals;
		}
		public override int GetHashCode()
		{
			return this.typeToken;
		}
	}
}
